home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_floater_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  4KB  |  104 lines

  1. #include "ewl_test.h"
  2.  
  3. static Ewl_Widget *floater_button = NULL;
  4.  
  5. static void
  6. __destroy_floater_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, 
  7.                     void *user_data __UNUSED__)
  8. {
  9.     ewl_widget_destroy(w);
  10.     ewl_callback_append(floater_button, EWL_CALLBACK_CLICKED,
  11.                 __create_floater_test_window, NULL);
  12. }
  13.  
  14. void
  15. __create_floater_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  16.                         void *user_data __UNUSED__)
  17. {
  18.     Ewl_Widget     *floater;
  19.     Ewl_Widget     *floater_win;
  20.     Ewl_Widget     *floater_box;
  21.     Ewl_Widget     *separator;
  22.     Ewl_Widget     *button[2];
  23.     Ewl_Widget     *check_button[2];
  24.     Ewl_Widget     *radio_button[2];
  25.  
  26.     floater_button = w;
  27.  
  28.     floater_win = ewl_window_new();
  29.     ewl_window_title_set(EWL_WINDOW(floater_win), "Floater Test");
  30.     ewl_window_name_set(EWL_WINDOW(floater_win), "EWL Test Application");
  31.     ewl_window_class_set(EWL_WINDOW(floater_win), "EFL Test Application");
  32.  
  33.     if (w) {
  34.         ewl_callback_del(w, EWL_CALLBACK_CLICKED, 
  35.                 __create_floater_test_window);
  36.         ewl_callback_append(floater_win, EWL_CALLBACK_DELETE_WINDOW,
  37.                     __destroy_floater_test_window, NULL);
  38.     } else
  39.         ewl_callback_append(floater_win, EWL_CALLBACK_DELETE_WINDOW,
  40.                         __close_main_window, NULL);
  41.     ewl_widget_show(floater_win);
  42.  
  43.     floater_box = ewl_vbox_new();
  44.     ewl_container_child_append(EWL_CONTAINER(floater_win), floater_box);
  45.     ewl_widget_show(floater_box);
  46.  
  47.     radio_button[0] = ewl_radiobutton_new();
  48.     ewl_button_label_set(EWL_BUTTON(radio_button[0]), "With Label");
  49.     ewl_container_child_append(EWL_CONTAINER(floater_box), radio_button[0]);
  50.     ewl_object_alignment_set(EWL_OBJECT(radio_button[0]),
  51.                  EWL_FLAG_ALIGN_LEFT);
  52.     ewl_widget_show(radio_button[0]);
  53.  
  54.     radio_button[1] = ewl_radiobutton_new();
  55.     ewl_button_label_set(EWL_BUTTON(radio_button[1]), NULL);
  56.     ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_button[1]), 
  57.                   EWL_RADIOBUTTON(radio_button[0]));
  58.     ewl_container_child_append(EWL_CONTAINER(floater_box), radio_button[1]);
  59.     ewl_object_alignment_set(EWL_OBJECT(radio_button[1]),
  60.                  EWL_FLAG_ALIGN_LEFT);
  61.     ewl_widget_show(radio_button[1]);
  62.  
  63.     floater = ewl_floater_new();
  64.     ewl_floater_follow_set(EWL_FLOATER(floater), radio_button[1]);
  65.     ewl_container_child_append(EWL_CONTAINER(floater_box), floater);
  66.     ewl_floater_position_set(EWL_FLOATER(floater), 20, 20);
  67.     ewl_widget_show(floater);
  68.  
  69.     button[0] = ewl_button_new();
  70.     ewl_button_label_set(EWL_BUTTON(button[0]), "With Label");
  71.     ewl_container_child_append(EWL_CONTAINER(floater), button[0]);
  72.     ewl_object_alignment_set(EWL_OBJECT(button[0]), EWL_FLAG_ALIGN_LEFT);
  73.     ewl_object_custom_size_set(EWL_OBJECT(button[0]), 100, 17);
  74.     ewl_widget_show(button[0]);
  75.  
  76.     button[1] = ewl_button_new();
  77.     ewl_button_label_set(EWL_BUTTON(button[1]), NULL);
  78.     ewl_container_child_append(EWL_CONTAINER(floater), button[1]);
  79.     ewl_object_alignment_set(EWL_OBJECT(button[1]), EWL_FLAG_ALIGN_LEFT);
  80.     ewl_object_custom_size_set(EWL_OBJECT(button[1]), 100, 17);
  81.     ewl_widget_show(button[1]);
  82.  
  83.     separator = ewl_hseparator_new();
  84.     ewl_container_child_append(EWL_CONTAINER(floater), separator);
  85.     ewl_widget_show(separator);
  86.  
  87.     ewl_object_padding_set(EWL_OBJECT(separator), 2, 2, 5, 5);
  88.  
  89.     check_button[0] = ewl_checkbutton_new();
  90.     ewl_button_label_set(EWL_BUTTON(check_button[0]), "With Label");
  91.     ewl_container_child_append(EWL_CONTAINER(floater), check_button[0]);
  92.     ewl_object_alignment_set(EWL_OBJECT(check_button[0]),
  93.                  EWL_FLAG_ALIGN_LEFT);
  94.     ewl_widget_show(check_button[0]);
  95.  
  96.     check_button[1] = ewl_checkbutton_new();
  97.     ewl_button_label_set(EWL_BUTTON(check_button[1]), NULL);
  98.     ewl_container_child_append(EWL_CONTAINER(floater), check_button[1]);
  99.     ewl_object_alignment_set(EWL_OBJECT(check_button[1]),
  100.                  EWL_FLAG_ALIGN_LEFT);
  101.     ewl_widget_show(check_button[1]);
  102. }
  103.  
  104.